﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Masters/WithoutPermBasic.Master" AutoEventWireup="true" CodeBehind="ProductionAnalyseReport.aspx.cs" Inherits="PMS.UI.DS.ProductionAnalyseReport" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript">
        $(function () {
            var height = $("#divTotal").height();
            var master = $("#master").height();
            var content = parseFloat(height) - parseFloat(master) - 30;
            $("#tbList").css("height", content);
        });
    </script>

    <script type="text/javascript">
        $(function () {
            $("#tbList").datagrid({
                url: '/Logic/DS/DataAnalysAjax.aspx?method=GetProductionList',
                loadMsg: '数据加载中请稍后……',
                fitColumns: false,
                pagination: true,
                queryParams: com.serializeSearchArray("form1"),
                rownumbers: true,
                idField: "ID",
                showFooter: true,
                singleSelect: true,
                pageSize: 20,
                pageList: [20, 50, 100],
                striped: true,
                columns: [[{ field: 'ck', checkbox: true, width: 30 },
                   {
                       field: 'CustomerName', title: '客户名称', align: 'center', width: 200
                   },
                   {
                       field: 'CompletedDate', title: '日期', align: 'center', width: 100
                   },
                   {
                       field: 'CompletedNum', title: '分析数量', align: "center", width: 60
                   },
                   {
                       field: 'AnalyseRes', title: '是否合格', align: "center", width: 60,
                       formatter: function (value, row, index) {
                           return com.getArrayText([
                               { value: "0", text: "合格" },
                               { value: "1", text: "不合格" }], value)
                       },
                       styler: function (value, row, index) {
                           if (value == "1") {
                               return 'color:red';
                           }
                       }
                   },
                   {
                       field: 'ProductName', title: '产品名称', align: 'center', width: 200,
                       formatter: function (value, row, index) {
                           //鼠标放在文本处自动显示tooltip
                           return '<span title=' + value + '>' + value + '</span>';
                       }
                   },
                   {
                       field: 'TechParams', title: '技术参数', align: 'center', width: 200,
                       formatter: function (value, row, index) {
                           //鼠标放在文本处自动显示tooltip
                           return '<span title=' + value + '>' + value + '</span>';
                       }
                   },

                {
                    field: 'BottleVolume', title: '规格/L', align: "center", width: 60
                }]],
            });

        });
    </script>

    <script type="text/javascript">
        //查询
        function funcSearch() {
            var para = com.serializeSearchArray("form1");
            $("#tbList").datagrid("load", para);
        }

        //重置
        function funcReload() {
            $("#form1").form("reset");
            var para = com.serializeSearchArray("form1");
            $("#tbList").datagrid("load", para);
        }

        //导出
        function funcToExcel() {
            var para = com.serializeSearchArray1("form1");
            //列标题
            var cellhead = {
                "CustomerName": "客户名称", "CompletedNum": "分析数量", "BottleVolume": "规格/L",
                "AnalyseRes": "是否合格", "ProductName": "产品名称", "CompletedDate": "日期",
                "TechParams": "技术参数"
            }
            var form = {};
            form['searchData'] = para;
            form['cellhead'] = JSON.stringify(cellhead);
            $.ajax({
                type: "POST",
                dataType: "json",
                url: "/Logic/DS/DataAnalysAjax.aspx?method=ProductionAnalyse2Excel",
                data: form,
                success: function (data) {
                    location.href = location.origin + '/' + data;
                }
            })
        }

    </script>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceToorbar" runat="server">
    <a href="javascript:void(0)" id="btnSearch" class="easyui-linkbutton" onclick="funcSearch()"
        data-options="iconCls:'icon-search',plain:true">查询</a> &nbsp;&nbsp;
    <a href="javascript:void(0)" id="btnReset" class="easyui-linkbutton" onclick="funcReload()"
        data-options="iconCls:'icon-reload',plain:true">重置</a> &nbsp;&nbsp;
    <a href="javascript:void(0)" id="btnToExcel" class="easyui-linkbutton" onclick="funcToExcel()"
        data-options="iconCls:'icon-page_excel',plain:true">导出Excel</a> &nbsp;&nbsp;
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">
    <div id="divTotal" style="height: 100%; width: 100%">

        <div id="master" class="container_16" style="height: auto">
            <form id="form1">
                <div class="grid_4 sealbl" style="text-align: right;">
                    客户名称 :
                    <input type="text" id="CustomerName" name="CustomerName" data-cp="co" />
                </div>
                <div class="grid_4 sealbl" style="text-align: right;">
                    日期从 :
                    <input type="text" id="startCompletedDate" name="startCompletedDate" data-cp="str>=" class="easyui-datebox" />
                </div>
                <div class="grid_4 sealbl" style="text-align: right;">
                    到 :
                    <input type="text" id="endCompletedDate" name="endCompletedDate" data-cp="str<=" class="easyui-datebox" />
                </div>
                <div class="grid_4 sealbl" style="text-align: right;">
                    规格/L :
                    <input type="text" id="BottleVolume" name="BottleVolume" data-cp="=" />
                </div>
                <div class="Clear"></div>
                <div class="grid_4 sealbl" style="text-align: right;">
                    是否合格 :
                    <input type="text" class="easyui-combobox" id="AnalyseRes" name="AnalyseRes" data-cp="="
                        data-options="valueField:'value',textField:'text',
                        data:[{ value: '', text: '全部'},
                        { value: '0', text: '合格' },
                                { value: '1', text: '不合格'}],panelHeight:'auto'" />
                </div>
            </form>
        </div>
        <table id="tbList" title="生产日报表 " style="width: 100%">
        </table>
    </div>
</asp:Content>
